<form class="layui-form">
  <div class="layui-form-item">
    <label class="layui-form-label">角色名称</label>
    <div class="layui-input-block">
      <input type="text" name="title" lay-verify="required" value="{$group_info.group_name}"  placeholder="请输入角色名称" autocomplete="off"  id="title" class="layui-input">
      <if condition="$group_info['group_id'] neq null"><input type="hidden" name="id" value="{$group_info.group_id}" /></if>
    </div>
  </div>
      <input type="hidden" name="description" value="0">
  <div class="layui-form-item">
    <div class="layui-input-block" style="margin: 0 auto;text-align: center;">
      <button class="layui-btn" lay-submit lay-filter="user">立即提交</button>
    </div>
  </div>
</form>
<script>
layui.use('form', function(){
	var form = layui.form(),
   	$ = layui.jquery;
    form.render();
    form.on('submit(user)', function(data){
      var groupInfo = data.field;
      var url = "__SELF__";
      $.post(url,groupInfo,function(data){
          if(data.code=='101'){
              layer.msg(data.msg, {
                  icon: 6,
                  time: 2000
              }, function(){
                  location.reload();
              });
            }else{
              layer.msg(data.msg,{icon: 5});
              return;
            }
      });
      return false;
	  });
	});
</script>